#include "BondOptionInfo.h"

#include <core/Utility.h>
#include <string.h>

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#ifdef _DEBUG
// #define	new	DEBUG_NEW
#endif

CBondOptionInfo::CBondOptionInfo() : m_CallStr(""), m_PutStr("") {
  memset(m_BondKeyListedMarket, 0, sizeof(m_BondKeyListedMarket));
  memset(m_OptionType, 0, sizeof(m_OptionType));
}

CBondOptionInfo::CBondOptionInfo(const CBondOptionInfo& info) {
  FIELDCOPY(m_BondKeyListedMarket, info.m_BondKeyListedMarket);
  FIELDCOPY(m_OptionType, info.m_OptionType);
  memcpy(m_BondKeyListedMarket, info.m_BondKeyListedMarket,
         sizeof(m_BondKeyListedMarket));
  m_CallStr = info.m_CallStr;
  m_PutStr = info.m_PutStr;
}

CBondOptionInfo::~CBondOptionInfo() {}

void CBondOptionInfo::Clear() {
  memset(m_BondKeyListedMarket, 0, sizeof(m_BondKeyListedMarket));
  m_CallStr.clear();
  m_PutStr.clear();
}

void CBondOptionInfo::SetCombBondKey(const char* sCombBondKey) {
  FIELDCOPY(m_BondKeyListedMarket, sCombBondKey);
}

void CBondOptionInfo::SetOptionType_(const char* sOptionType) {
  FIELDCOPY(m_OptionType, sOptionType);
}

void CBondOptionInfo::SetCallStr(const char* sCallStr) {
  m_CallStr = sCallStr ? sCallStr : "";
}

void CBondOptionInfo::SetPutStr(const char* sPutStr) {
  m_PutStr = sPutStr ? sPutStr : "";
}

const char* CBondOptionInfo::GetCombBondKey() const {
  return m_BondKeyListedMarket;
}

const char* CBondOptionInfo::GetOptionType_() const { return m_OptionType; }

const char* CBondOptionInfo::GetCallStr() const { return m_CallStr.c_str(); }
const char* CBondOptionInfo::GetPutStr() const { return m_PutStr.c_str(); }
